﻿using D.Medicalcare.Domain.Entities;
using D.Medicalcare.ErrorCode;
using D.Medicalcare.Read.API.Application.Command.HeaEncyclopeCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace D.Medicalcare.Read.API.Controllers
{
    /// <summary>
    /// 健康百科
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class HeaEncyclopeController : ControllerBase
    {


        private readonly IMediator mediator;

        public HeaEncyclopeController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 健康百科显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<HeaEncyclope>> GetHeaEncyclope([FromQuery]GetHeaEncyclopeCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }


        }





        }
    }
